wayland: use g_clear_pointer when destroying cairo surfaces
authorRay Strode <rstrode@redhat.com>
Wed, 3 Feb 2016 01:43:12 +0000 (20:43 -0500)
committerRay Strode <rstrode@redhat.com>
Sat, 6 Feb 2016 13:00:35 +0000 (08:00 -0500)
There are a few places where we destroy a cairo surface and
then nullify it. This commit changes those to use
g_clear_pointer instead.

It also drops a cairo_surface_finish call that is unnecessary

https://bugzilla.gnome.org/show_bug.cgi?id=761312

gdk/wayland/gdkwindow-wayland.c

index c349fd5b8405165aa8d36ac9a78364bb2dde8192..f5a0546c764a2cad5b12d7ee7d1132c02ff21e7e 100644 (file)
@@ -208,11 +208,7 @@ gdk_wayland_window_update_size (GdkWindow *window,
   GdkRectangle area;
   cairo_region_t *region;
 
-  if (impl->cairo_surface)
-    {
-      cairo_surface_destroy (impl->cairo_surface);
-      impl->cairo_surface = NULL;
-    }
+  g_clear_pointer (&impl->cairo_surface, cairo_surface_destroy);
 
   window->width = width;
   window->height = height;
@@ -1849,12 +1845,7 @@ gdk_wayland_window_destroy (GdkWindow *window,
 
   gdk_wayland_window_hide_surface (window);
 
-  if (impl->cairo_surface)
-    {
-      cairo_surface_finish (impl->cairo_surface);
-      cairo_surface_destroy (impl->cairo_surface);
-      impl->cairo_surface = NULL;
-    }
+  g_clear_pointer (&impl->cairo_surface, cairo_surface_destroy);
 }
 
 static void